<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="perm" uri="/WEB-INF/tld/perm.tld"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<script>var ctx="${ctx}";</script>
<form class="form-horizontal" role="form" >
	<input type="hidden" id="token" name="token" value="<%=request.getAttribute("token") %>" />
	<div class="">
		<input type="file" class="file-pos" id="member-avatar" name="imageFile" style="display: none;">
		<img id="headImage" src="${member.headImage}" alt="">
	</div>
	<div class="form-group">
 	    <label class="col-md-3 col-sm-3 control-label">昵称:</label>
        <div class="col-md-9">
<%--         	 <input id="nickName" value="${member.nickName}" data-check="require:true,code:input1,minlen:2,maxlen:20, message:2-20中文或字母" type="text" placeholder="昵称" class="form-control" name="nickName"/> --%>
        	 <input id="nickName" value="${member.nickName}" data-check=" message:2-20中文或字母" type="text" placeholder="昵称" class="form-control" name="nickName"/>
        </div>
    </div>
       	<div class="form-group">
 	    <label class="col-md-3 col-sm-3 control-label">头像:</label>
        <div class="col-md-9">
        	 <div class="col-md-10">
	        	 <input class="fileInput" id="imageUploadify" type="file" name="file"  accept="image/*"/>
	        	 <div class="imageUploadify" id="logodiv">   
					<c:if test="${not empty(member.headImage)}">
						<img src="${member.headImage}" style="width: 60px;height: 60px">
					</c:if>
				 </div>
	        </div>
        </div>
      </div>
      <div class="form-group">
 	    <label class="col-md-3 col-sm-3 control-label">身份证照片:</label>
        <div class="col-md-9">
        	 <div class="col-md-10">
	        	 <input class="fileInput" id="licenseUploadify" type="file" name="file"  accept="image/*"/>
	        	 <div class="imageUploadify" id="licensediv">   
					<c:if test="${not empty(member.cardImage)}">
					<c:forEach items="${fn:split(member.cardImage,',')}" var="i">
						<img src="${i}" style="width: 60px;height: 60px">
					</c:forEach>
					</c:if>
				 </div>
	        </div>
        </div>
      </div>
    <div class="form-group">
 		<label class="col-md-3 col-sm-3 control-label">性别:</label>
        <div class="col-md-9">
        	<div class="form-inline" >
        	<div class="checkbox i-checks">
                 <label><input type="radio"  name="gender" id="gender_famale" value="1" <c:if test="${member.gender==0}">checked="checked"</c:if> checked=""> <i></i>男</label>
             </div>
             <div class="checkbox i-checks">
                 <label><input type="radio"  name="gender" id="gender_male" value="2" <c:if test="${member.gender==1}">checked="checked"</c:if> > <i></i>女</label>
             </div>
            </div>
        </div>
    </div>
	<div class="form-group">
 	    <label class="col-md-3 col-sm-3 control-label">真实姓名:</label>
        <div class="col-md-9">
        	 <input id="name" value="${member.name}" data-check=" message:2-20中文或字母" type="text" placeholder="真实姓名" class="form-control" name="nickName"/>
        </div>
    </div>
	<div class="form-group">
 	    <label class="col-md-3 col-sm-3 control-label">生日:</label>
        <div class="col-md-9">
        	  <input id="saleTime" type="text" class="input-md form-control layer-date" placeholder="生日"  name="saleTime">
        </div>
    </div>
    <div class="form-group">
 	    <label class="col-md-3 col-sm-3 control-label">行业:</label>
        <div class="col-md-9">
        	<select id="typeId" placeholder="选择行业" class="chosen-select full-width" tabindex="4">
			</select>
        </div>
    </div>
<!-- 	<div class="form-group"> -->
<!--  	    <label class="col-md-3 col-sm-3 control-label">生日:</label> -->
<!--         <div class="col-md-9"> -->
<%--         	 <input id="birthday" value="${member.birthday}" data-check=" message:2-20中文或字母" type="text" placeholder="生日" class="form-control" name="nickName"/> --%>
<!--         </div> -->
<!--     </div> -->
	<div class="form-group">
 	    <label class="col-md-3 col-sm-3 control-label">手机号:</label>
        <div class="col-md-9">
        	 <input id="mobile" value="${member.mobile}" data-check=" message:请输入至少7为数字" type="text" placeholder="手机号" class="form-control" name="nickName"/>
        </div>
    </div>
	<div class="form-group">
 	    <label class="col-md-3 col-sm-3 control-label">身份证号:</label>
        <div class="col-md-9">
        	 <input id="cardNo" value="${member.cardNo}" data-check=" message:2-20中文或字母" type="text" placeholder="身份证号码" class="form-control" name="nickName"/>
        </div>
    </div>
    <div class="form-group">
 	    <label class="col-md-3 col-sm-3 control-label">用户类型:</label>
        <div class="col-md-9">
        	  <select data-placeholder="用户类型" id="type" class="input-md form-control chosen-select layer-date" tabindex="4" name="saleTimeS">
                  <option value="0">手机用户</option>
                  <option value="1">第三方用户</option>
              </select>
        </div>
    </div>
</form>
<iframe style="display: none" name='hidden_frame' id="hidden_frame"></iframe>
<script>
	var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch'));
	elems.forEach(function(html) {
		var switchery = new Switchery(html);
	});
	$(function(){
		 $('input').iCheck('destroy');
		 $(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green"});	 
	})

	$("#imageUploadify").uploadify({
	'buttonImage':'${ctx}/static/js/plugins/uploadify/uploadify-button.png',
    'swf': '${ctx}/static/js/plugins/uploadify/uploadify.swf',
    'uploader':'${ctx}/file/uploadOss',
    "multi":false,
    'onFallback' : function() {//检测FLASH失败调用 
    	alert("您未安装FLASH控件，无法上传图片！请安装FLASH控件后再试。");  
    },  
    'onUploadSuccess':function(file, data, response){
    	var jData = jQuery.parseJSON(data);
        $("#logodiv").html("<img src=\""+jData.data+"\" style=\"width: 60px;height: 60px;padding-left:5px;\">");
	}
});

$("#licenseUploadify").uploadify({
	'buttonImage':'${ctx}/static/js/plugins/uploadify/uploadify-button.png',
    'swf': '${ctx}/static/js/plugins/uploadify/uploadify.swf',
    'uploader':'${ctx}/file/uploadOss',
    "multi":false,
    'onFallback' : function() {//检测FLASH失败调用 
    	alert("您未安装FLASH控件，无法上传图片！请安装FLASH控件后再试。");  
    },  
    'onUploadSuccess':function(file, data, response){
    	var jData = jQuery.parseJSON(data);
        $("#licensediv").append("<img src=\""+jData.data+"\" style=\"width: 60px;height: 60px;padding-left:5px;\">");
	}
});
	
$(function(){
	var saleTime = {
        elem: "#saleTime",
        format: "YYYY-MM-DD",
        istime: true,
        istoday: true,
        choose: function(datas) {
        }
    };
    laydate(saleTime);
})

			var typeId="${departmentId}";
			$("#typeId").chosen({ width: '100%' });
			
			$.ajax({  
				url:'${ctx}/merchantType/list',  		 					
				data:{						
				},   
				type: 'POST',
				dataType:'json',  
				success:function(response){
					if(response.code==0){
						var html=[];
						var data=response.data||[];
						for(var i=0;i<data.length;i++){
							html.push('<option value="'+data[i].id+'" ');
							html.push('>'+data[i].name+'</option>');
						}
						$("#typeId").append(html.join(""));
						$("#typeId").trigger("chosen:updated");
					}
				}  
		     });
</script>
